package com.baidu.erp.demo;

import com.baidu.erp.domain.Permission;
import com.baidu.erp.domain.PermissionVO;
import com.baidu.erp.sercvice.PermissionService;
import com.baidu.erp.sercvice.impl.PermissionServiceImpl;
import com.baidu.erp.utils.BeanCopierUtil;

import java.util.List;

public class Demo {
    public static void main(String[] args) {
        //需要拷贝的对象
        PermissionService permissionService = new PermissionServiceImpl();
        List<Permission> permissionList = permissionService.getAll();
        Permission permission = permissionList.get(1);

        //拷贝的目标对象
        PermissionVO permissionVO = new PermissionVO();
        System.out.println(permission);
        System.out.println(permissionVO);
        System.out.println("=======");
        //创建工具类
        //形参 (拷贝对象的类型,目标对象的类型,是否需要自定义转换类进行拷贝)
//        BeanCopier beanCopier = BeanCopier.create(Permission.class,PermissionVO.class,false);
//        //进行拷贝
//        beanCopier.copy(permission,permissionVO,null);

        BeanCopierUtil.copy(permission,permissionVO);
        System.out.println(permission);
        System.out.println(permissionVO);
    }
}
